<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class free extends MY_Controller {

	public function _remap($method){
		$this->carabiner->css(array(
				array('bootstrap/bootstrap-simplex.css', 'screen'),
				array('base.css', 'screen')
		));
		$this->carabiner->js(array(
				array('libs/jquery.min.js'),
				array('bootstrap/bootstrap-dropdown.js'),
				array('bootstrap/bootstrap-modal.js'),
				array('tic/footer.js'),
		));

    if($this->session->userdata('id_usuario'))
    {
      if ($this->session->userdata['acceso'] === 'admin' || $this->session->userdata['tipo'] === 'gratuito')
        $this->{$method}();
      else
        redirect(base_url('tic/'));
    }
    else
      redirect(base_url());
	}


	public function index()
	{
		$this->carabiner->css(array(
			array('libs/jquery.tinyscroll.css', 'screen'),
			array('libs/jquery.smoothDivScroll.css', 'screen'),
			array('libs/jquery.slider.css', 'screen'),
			array('free.css', 'screen'),
			array('barra_rfree.css', 'screen'),

			array('libs/jquery.superbox.css', 'screen')
		));
		$this->carabiner->js(array(
				array('libs/jquery.html5placeholder.js'),
				array('libs/jquery.tinyscrollbar.min.js'),
				array('libs/jquery-ui.js'),
				array('libs/jquery.mousewheel.min.js'),
				array('libs/jquery.smoothdivscroll-1.2-min.js'),
				array('libs/jquery.slides.min.js'),
        array('http://connect.facebook.net/en_US/all.js'),
				array('free/free.js'),
				array('free/barra_rfree.js'),

				array('home/checker.js'),
				array('libs/jquery.superbox.js')
		));

		$params['seo'] = array('titulo' => 'Tienda Capp');

		$this->load->model('skin_model');

		$params['bpp'] = $this->db->query("SELECT id_articulo, numero, titulo, imagen1, fecha_creacion
			FROM articulos WHERE status = 1 AND id_tipo = 1 AND Date(fecha_creacion) <= Date(Now()) ORDER BY numero DESC")->result();

		$params['cp'] = $this->db->query("SELECT id_articulo, numero, titulo, imagen1, fecha_creacion
			FROM articulos WHERE status = 1 AND id_tipo = 2 AND Date(fecha_creacion) <= Date(Now()) ORDER BY numero DESC")->result();

		$params['bd'] = $this->db->query("SELECT id_articulo, numero, titulo, imagen1, fecha_creacion
			FROM articulos WHERE status = 1 AND id_tipo = 3 AND Date(fecha_creacion) <= Date(Now()) ORDER BY numero DESC")->result();

		$params['ventas'] = $this->skin_model->getAsesoriaVenta();

    $this->load->library('my_facebook');
    $params['fb_app_id'] = $this->my_facebook->APP_ID;
    $params['username'] = $this->session->userdata('nombre');

		if ($this->session->userdata('tipo') == 'tic') {
			$params['barra_r'] = $this->load->view('skin/free/barra_right_free', $params, true);
		}else{
			$params['barra_r'] = $this->load->view('skin/free/barra_right_free', $params, true);
		}

		$this->load->view('skin/header', $params);
		$this->load->view('skin/free/categorias', $params);
		$this->load->view('skin/footer');
	}


	public function faqs(){
		$this->load->view('skin/home/faqs');
	}

	public function about(){
		$this->load->view('skin/home/about');
	}

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */